package com.liberation.aidiancan.view.activities;

import android.view.View;
import android.widget.FrameLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;

import com.liberation.aidiancan.R;
import com.liberation.aidiancan.base.BaseActivity;
import com.liberation.aidiancan.presenter.BasePresent;
import com.liberation.aidiancan.view.fragments.BuyingFragment;
import com.liberation.aidiancan.view.fragments.HomeFragment;
import com.liberation.aidiancan.view.fragments.MeFragment;
import com.liberation.aidiancan.view.fragments.MessageFragment;

import butterknife.BindView;
import butterknife.ButterKnife;


public class MainActivity extends BaseActivity {

	@BindView(R.id.framgment)
	FrameLayout mFgPager;
	@BindView(R.id.line)
	View mLine;
	@BindView(R.id.main_menu_group_restaurant)
	RadioButton mMainMenuGroupRestaurant;
	@BindView(R.id.main_menu_group_buying)
	RadioButton mMainMenuGroupBuying;
	@BindView(R.id.main_menu_group_message)
	RadioButton mMainMenuGroupMessage;
	@BindView(R.id.main_menu_group_me)
	RadioButton mMainMenuGroupMe;
	@BindView(R.id.main_menu_group)
	RadioGroup mMainMenuGroup;

	@Override
	public void init() {
		ButterKnife.bind(this);


	}

	@Override
	public void loadData() {
		mMainMenuGroup.getChildAt(0).performClick(); //默认加载的homefragment
		mMainMenuGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(RadioGroup group, int checkedId) {
				switch (checkedId) {
					case R.id.main_menu_group_buying: {
						fragmentManager(R.id.framgment, new BuyingFragment(), "BuyingFragment");
					}
					break;
					case R.id.main_menu_group_restaurant: {
						fragmentManager(R.id.framgment, new HomeFragment(), "HomeFragment");
					}
					break;
					case R.id.main_menu_group_message: {
						fragmentManager(R.id.framgment, new MessageFragment(), "MessageFragment");
					}
					break;
					case R.id.main_menu_group_me: {
						fragmentManager(R.id.framgment, new MeFragment(), "MeFragment");
					}
					break;

				}
			}
		});
	}

	@Override
	public int setContentViews() {
		return R.layout.activity_main;
	}

	@Override
	public BasePresent createPresenter() {
		return null;
	}
}
